﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Game.templates.item
{
    public class Bodypart
    {
        private int _mask;
        private Bodypart _real;
        private string _name;
        Bodypart(string name,int mask):this(name,mask, null)
        {
            //;
        }
        public override string ToString()
        {
            return _name;
        }
        Bodypart(string name,int mask, Bodypart real)
        {
            _name = name;
            _mask = mask;
            _real = real;
        }
        public int mask()
        {
            return _mask;
        }
        public Bodypart getReal()
        {
            return _real;
        }

        public static readonly Bodypart NONE = new Bodypart("NONE", ItemTemplate.SLOT_NONE);
        public static readonly Bodypart CHEST = new Bodypart("CHEST", ItemTemplate.SLOT_CHEST);
        public static readonly Bodypart BELT = new Bodypart("BELT", ItemTemplate.SLOT_BELT);
        public static readonly Bodypart RIGHT_BRACELET = new Bodypart("RIGHT_BRACELET", ItemTemplate.SLOT_R_BRACELET);
        public static readonly Bodypart LEFT_BRACELET = new Bodypart("LEFT_BRACELET", ItemTemplate.SLOT_L_BRACELET);
        public static readonly Bodypart FULL_ARMOR = new Bodypart("FULL_ARMOR", ItemTemplate.SLOT_FULL_ARMOR);
        public static readonly Bodypart HEAD = new Bodypart("HEAD", ItemTemplate.SLOT_HEAD);
        public static readonly Bodypart HAIR = new Bodypart("HAIR", ItemTemplate.SLOT_HAIR);
        public static readonly Bodypart FACE = new Bodypart("FACE", ItemTemplate.SLOT_DHAIR);
        public static readonly Bodypart HAIR_All = new Bodypart("HAIR_ALL", ItemTemplate.SLOT_HAIRALL);
        public static readonly Bodypart UNDERWEAR = new Bodypart("UNDERWEAR", ItemTemplate.SLOT_UNDERWEAR);
        public static readonly Bodypart BACK = new Bodypart("BACK", ItemTemplate.SLOT_BACK);
        public static readonly Bodypart NECKLACE = new Bodypart("NECKLACE", ItemTemplate.SLOT_NECK);
        public static readonly Bodypart LEGS = new Bodypart("LEGS", ItemTemplate.SLOT_LEGS);
        public static readonly Bodypart FEET = new Bodypart("FEET", ItemTemplate.SLOT_FEET);
        public static readonly Bodypart GLOVES = new Bodypart("GLOVES", ItemTemplate.SLOT_GLOVES);
        public static readonly Bodypart RIGHT_HAND = new Bodypart("RIGHT_HAND", ItemTemplate.SLOT_R_HAND);
        public static readonly Bodypart LEFT_HAND = new Bodypart("LEFT_HAND", ItemTemplate.SLOT_L_HAND);
        public static readonly Bodypart LEFT_RIGHT_HAND = new Bodypart("LEFT_RIGHT_HAND", ItemTemplate.SLOT_LR_HAND);
        public static readonly Bodypart RIGHT_EAR = new Bodypart("RIGHT_EAR", ItemTemplate.SLOT_R_EAR);
        public static readonly Bodypart LEFT_EAR = new Bodypart("LEFT_EAR", ItemTemplate.SLOT_L_EAR);
        public static readonly Bodypart RIGHT_FINGER = new Bodypart("RIGHT_FINGER", ItemTemplate.SLOT_R_FINGER);
        public static readonly Bodypart FORMAL_WEAR = new Bodypart("FORMAL_WEAR", ItemTemplate.SLOT_FORMAL_WEAR);
        public static readonly Bodypart TALISMAN = new Bodypart("TALISMAN", ItemTemplate.SLOT_DECO);
        public static readonly Bodypart LEFT_FINGER = new Bodypart("LEFT_FINGER", ItemTemplate.SLOT_L_FINGER);
        public static readonly Bodypart WOLF = new Bodypart("WOLF", ItemTemplate.SLOT_WOLF, CHEST);
        public static readonly Bodypart GREAT_WOLF = new Bodypart("GREAT_WOLF", ItemTemplate.SLOT_GWOLF, CHEST);
        public static readonly Bodypart HATCHLING = new Bodypart("HATCHLING", ItemTemplate.SLOT_HATCHLING, CHEST);
        public static readonly Bodypart STRIDER = new Bodypart("STRIDER", ItemTemplate.SLOT_STRIDER, CHEST);
        public static readonly Bodypart BABY_PET = new Bodypart("BABY_PET", ItemTemplate.SLOT_BABYPET, CHEST);
        public static readonly Bodypart PENDANT = new Bodypart("PENDANT", ItemTemplate.SLOT_PENDANT, NECKLACE);

        public static IEnumerable<Bodypart> Values
        {
            get { 
                yield return NONE;
                yield return CHEST;
                yield return BELT;
                yield return RIGHT_BRACELET;
                yield return LEFT_BRACELET;
                yield return FULL_ARMOR;
                yield return HEAD;
                yield return HAIR;
                yield return FACE;
                yield return HAIR_All;
                yield return UNDERWEAR;
                yield return BACK;
                yield return NECKLACE;
                yield return LEGS;
                yield return FEET;
                yield return GLOVES;
                yield return RIGHT_HAND;
                yield return LEFT_HAND;
                yield return LEFT_RIGHT_HAND;
                yield return RIGHT_EAR;
                yield return LEFT_EAR;
                yield return RIGHT_FINGER;
                yield return FORMAL_WEAR;
                yield return TALISMAN;
                yield return LEFT_FINGER;
                yield return WOLF;
                yield return GREAT_WOLF;
                yield return HATCHLING;
                yield return STRIDER;
                yield return BABY_PET;
                yield return PENDANT;
            }
        }
    }
}
